package com.ebocy.hammer.battle.fight.message;

import com.ebocy.hammer.core.constants.GameMessageCode;
import com.ebocy.hammer.core.domain.GamePlayer;
import com.ebocy.hammer.core.message.AbstractS2CMessage;

public class S2CEnterRoomNotifyMessage extends AbstractS2CMessage {
	private String playerId;
	private short x;
	private short y;
	private byte dir;

	public S2CEnterRoomNotifyMessage(GamePlayer gamePlayer) {
		this.playerId = gamePlayer.getId();
		this.x = gamePlayer.getX();
		this.y = gamePlayer.getY();
		this.dir = gamePlayer.getDir();
	}

	@Override
	protected void writeMessage() {
		writeString(playerId);
		writeShort(x);
		writeShort(y);
		writeByte(dir);
	}

	@Override
	public short getMessageCode() {
		return GameMessageCode.ENTER_ROOM_NOTIFY;
	}

}
